/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package WebBrower_DAO;

import WebBrowser_DTO.ContentNews_DTO;
import WebBrowser_DTO.Website_DTO;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Administrator
 */
public class ContentNews_DAO {
    public List<ContentNews_DTO> GetAllByWebsiteLinkID(int websitelinkid)
    {
        List<ContentNews_DTO> listResult= new ArrayList<>();
        try{
            SqlDataHelper helper = new SqlDataHelper();
            helper.OpenConnection();
            ParamDTO param = new ParamDTO("WebsiteLinkID",
                    DataTypeParam.IntegerType, websitelinkid);

            ResultSet data = helper.excuteQuerySelect("sp_GetContentNewsByWebsiteLinkID", param);
            ContentNews_DTO info = null;
            if (data.next()) {
                info = new ContentNews_DTO();
                info.setContentNewsID(data.getInt("ContentNewsID"));
                info.setWebsiteLinkID(data.getInt("WebsiteLinkID"));
                info.setPageNewsID(data.getInt("PageNewsID"));
                info.setNoiDungHtml(data.getString("NoiDungHtml"));
                info.setXpath(data.getString("Xpath"));
                info.setXoa(data.getBoolean("Xoa"));
                listResult.add(info);
            }
            helper.CloseConnection();
        }catch(Exception ex){}
        return listResult;
    }
}
